<?php


namespace app\common\utils;


class Helper
{
    /**
     * @param $num
     * @param $total
     * @return false|float|string
     * Created by chenyawei on 2024/7/16
     * Description:除发
     */
    public static function getDiv($num,$total){
        return ($num==0||$total==0)?"0.00":(round(($num/$total)*100,2));
    }

    /**
     * @param $num
     * @param $total
     * @return false|float|string
     * Created by chenyawei on 2024/7/16
     * Description:计算除 +%
     */
    public static function getRate($num,$total){
        return ($num==0||$total==0)?"0.00%":(round(($num/$total)*100,2).'%');
    }
}